<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload = function () {
            document.onkeydown = function (event) {
                console.log(event.key);
            };
            document.onkeyup = function (event) {
                console.log(event.key);
            }

        }
    </script>
</head>
<body>
<p><input/></p>
<p></p>
<p></p>
<p></p>
</body>
</html>